package com.sdk.es.sdk.api;


import com.alibaba.fastjson.TypeReference;
import com.lims.feign.test.req.TestReq;
import com.sdk.es.sdk.api.base.EsBaseHttpManager;
import com.sdk.es.sdk.entity.base.Test1;
import com.sdk.es.sdk.entity.common.EsBaseParams;
import com.sdk.es.sdk.entity.common.EsResult;
import com.sdk.es.sdk.entity.vo.resp.TestResp;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.lang.reflect.Type;
import java.util.List;

/**
 * @author limaosheng
 * @create 2024-03-07 16:40
 * @desc
 */
@Service
public class EsTest1Manager extends EsBaseHttpManager<Test1> {

    @Value("${feign.url}/elasticsearch/test1/basic")
    protected String URL_PREFIX;

    public EsResult<List<TestResp>> getTestList(EsBaseParams<TestReq> req) {
        Type type = new TypeReference<EsResult<List<TestResp>>>(){}.getType();
        EsResult<List<TestResp>> result = this.postBody("/getTestList", req, type);
        return result;
    }

    @Override
    protected String getUrl() {
        return URL_PREFIX;
    }
}
